import { getProvinceData } from "@/api/system/config";

export default {
  data() {
    return {
      provinceOptions: [],
      allCityList: [],
      cascaderProps: {
        value: "name",
        label: "name",
        checkStrictly: true,
        children: "cityList",
      },
    };
  },
  methods: {
    async getProvinceData() {
      const { data } = await getProvinceData();
      this.provinceOptions = data;
      this.allCityList = data
        .map((i) => {
          return i.cityList.map((_i) => ({
            ..._i,
            completeName: `${i.name} ${_i.name}`,
          }));
        })
        .flat();
    },
  },
  mounted() {
    this.getProvinceData();
  },
};
